<template>
	<view class="wrap">
		<u-toast ref="uToast" z-index="12000" />
		<view class="return_box zIndex">
			<view class="return_title">{{ eqptInfo.number }}</view>
			<view class="return_icon u-flex u-row-center u-col-center" @tap="$u.throttle(fnReturn, APP.during)">
				<image src="/static/svg/return.svg"></image>
			</view>

			<view class="return_right u-flex u-row-center u-col-center"
				:class="tabCurrent == 1 || tabCurrent == 2 ? '' : 'hide'" @tap="$u.throttle(fnSearchShow, APP.during)">
				<image src="/static/svg/search.svg"></image>
			</view>
		</view>
		<view class="blank"></view>
		<!-- 设备统计一 -->
		<u-tabs-swiper v-if="eqptInfo.isCalibration" ref="tabs" :list="tabList" :current="tabCurrent"
			@change="fnTabChange" :activeFontSize="32" :inactiveFontSize="26"></u-tabs-swiper>
		<u-tabs-swiper v-else ref="tabs" :list="tabList1" :current="tabCurrent" @change="fnTabChange"
			:activeFontSize="32" :inactiveFontSize="26"></u-tabs-swiper>

		<swiper class="swiper-box" :style="{ height: height + 'px' }" :current="tabSwiper" @transition="fnTabTransition"
			@animationfinish="fnTabAnimationFinish">
			<!-- 数据统计 -->
			<swiper-item class="swiper_item">
				<view class="tab_one_top u-flex u-row-center u-col-center">
					<view class="top_cont u-flex u-row-center u-col-center">
						<view class="cont_item u-flex-col" @tap="$u.throttle(fnGoHistory, APP.during)">
							<view class="item_num">{{ alarmCount }}</view>
							<view class="item_text">预报警(次)</view>
						</view>
						<view class="cont_item u-flex-col" @tap="$u.throttle(fnGoHoist, APP.during)">
							<view class="item_num">{{ cycleCount }}</view>
							<view class="item_text">吊装(次)</view>
						</view>
						<view class="cont_item u-flex-col">
							<view class="item_num" :class="safeCount > 60 ? 'green' : 'red'">{{ safeCount }}</view>
							<view class="item_text">安全运行率(%)</view>
						</view>
					</view>
				</view>
				<view class="tab_list u-flex u-row-center u-col-center" v-if="firstInfo">
					<view class="list_cont u-flex-col u-row-center u-col-center">
						<view class="cont_title u-flex u-row-between u-col-center">
							<view class="title_left"
								:class="!firstInfo.status? '': APP.fnAccessStatusToText(firstInfo.status, 'crane').status == 1? 'orange': APP.fnAccessStatusToText(firstInfo.status, 'crane').status == 2? 'red': ''">
								{{ fnGetText(firstInfo.status) }}
							</view>
							<view class="title_right">
								{{ firstInfo.record_at&&firstInfo.record_at ? firstInfo.record_at : '' }}
							</view>
						</view>
						<view class="cont_item u-flex">
							<view class="item_one">
								<view class="item_num">
									{{ firstInfo.status&&firstInfo.status ? APP.fnAccessStatusToText(firstInfo.status, 'crane').msg : '' }}
								</view>
								<view class="item_text">设备状态</view>
							</view>
							<view class="item_one">
								<view class="item_num">
									{{ firstInfo.safe_load&&firstInfo.safe_load != 0 ? firstInfo.safe_load : 0 }}
								</view>
								<view class="item_text">允许载重 (kg)</view>
							</view>
							<view class="item_one">
								<view class="item_num">{{ firstInfo.load&&firstInfo.load != 0 ? firstInfo.load : 0 }}
								</view>
								<view class="item_text">当前载重 (kg)</view>
							</view>
							<view class="item_one">
								<view class="item_num">
									{{ firstInfo.height&&firstInfo.height != 0 ? firstInfo.height / 10 : 0 }}
								</view>
								<view class="item_text">高度 (m)</view>
							</view>
						</view>
						<view class="cont_item u-flex">
							<view class="item_one">
								<view class="item_num">
									{{ firstInfo.amplitude&&firstInfo.amplitude != 0 ? firstInfo.amplitude / 10 : 0 }}
								</view>
								<view class="item_text">幅度 (m)</view>
							</view>
							<view class="item_one">
								<view class="item_num">
									{{ firstInfo.rotation&&firstInfo.rotation != 0 ? firstInfo.rotation / 10 : 0 }}
								</view>
								<view class="item_text">回转 (°)</view>
							</view>
							<view class="item_one">
								<view class="item_num">
									{{ firstInfo.torque_percentage&&firstInfo.torque_percentage != 0 ? firstInfo.torque_percentage : 0 }}
								</view>
								<view class="item_text">力矩 (%)</view>
							</view>
							<view class="item_one">
								<view class="item_num">
									{{ firstInfo.tilt&&firstInfo.tilt != 0 ? firstInfo.tilt / 100 : 0 }}
								</view>
								<view class="item_text">倾角 (°)</view>
							</view>
						</view>
						<view class="cont_item u-flex">
							<view class="item_one">
								<view class="item_num">
									{{ firstInfo.wind_speed&&firstInfo.wind_speed != 0 ? firstInfo.wind_speed / 10 : 0 }}
								</view>
								<view class="item_text">风速 (m/s)</view>
							</view>
						</view>
					</view>
				</view>
				<view class="chart_box"><canvas class="charts" canvas-id="canvasLineB" id="canvasLineB"
						@touchstart="touchIt($event, 'canvasLineB')"></canvas></view>
			</swiper-item>
			<!-- 历史实时数据 -->
			<swiper-item class="swiper_item">
				<view v-if="historyList && historyList.length > 0">
					<view class="tab_list u-flex u-row-center u-col-center" v-for="(item, index) in historyList"
						:key="index">
						<view class="list_cont u-flex-col u-row-center u-col-center">
							<view class="cont_title u-flex u-row-between u-col-center">
								<view class="title_left"
									:class="APP.fnAccessStatusToText(item.status, 'crane').msg == '预警' ? 'orange' : APP.fnAccessStatusToText(item.status, 'crane').msg == '报警' ? 'red' : ''">
									{{ fnGetText(item.status) }}
								</view>
								<view class="title_right">{{ item.record_at }}</view>
							</view>
							<view class="cont_item u-flex">
								<view class="item_one">
									<view class="item_num"
										:class="APP.fnAccessStatusToText(item.status, 'crane').msg == '预警' ? 'orange' : APP.fnAccessStatusToText(item.status, 'crane').msg == '报警' ? 'red' : ''">
										{{ APP.fnAccessStatusToText(item.status, 'crane').msg }}
									</view>
									<view class="item_text">设备状态</view>
								</view>
								<view class="item_one">
									<view class="item_num">{{ item.safe_load }}</view>
									<view class="item_text">允许载重 (kg)</view>
								</view>
								<view class="item_one">
									<view class="item_num">{{ item.load }}</view>
									<view class="item_text">当前载重 (kg)</view>
								</view>
								<view class="item_one">
									<view class="item_num">{{ parseFloat(item.height / 10).toFixed(2) }}</view>
									<view class="item_text">高度 (m)</view>
								</view>
							</view>
							<view class="cont_item u-flex">
								<view class="item_one">
									<view class="item_num">{{ parseFloat(item.amplitude / 10).toFixed(2) }}</view>
									<view class="item_text">幅度 (m)</view>
								</view>
								<view class="item_one">
									<view class="item_num">{{ parseFloat(item.rotation / 10).toFixed(2) }}</view>
									<view class="item_text">回转 (°)</view>
								</view>
								<view class="item_one">
									<view class="item_num">{{ item.torque_percentage }}</view>
									<view class="item_text">力矩 (%)</view>
								</view>
								<view class="item_one">
									<view class="item_num">{{ parseFloat(item.tilt / 100).toFixed(2) }}</view>
									<view class="item_text">倾角 (°)</view>
								</view>
							</view>
							<view class="cont_item u-flex">
								<view class="item_one">
									<view class="item_num">
										{{ firstInfo.wind_speed != 0 ? parseFloat(firstInfo.wind_speed / 10).toFixed(2) : 0 }}
									</view>
									<view class="item_text">风速 (m/s)</view>
								</view>
							</view>
						</view>
					</view>
					<u-loadmore class="u-m-b-40 u-m-t-40" :status="loadStatus[0]" bgColor="#ffffff"></u-loadmore>
				</view>
				<u-empty style="width: 100%;height: 600rpx;" v-else text="没有更多数据" mode="list"></u-empty>
			</swiper-item>
			<!-- 吊装记录 -->
			<swiper-item class="swiper_item">
				<view v-if="hoistList && hoistList.length > 0">
					<view class="record_box u-flex u-row-center u-col-center" v-for="(item, index) in hoistList"
						:key="index">
						<view class="record_cont">
							<view class="cont_time">{{ item.create_at }}</view>
							<view class="cont_item u-flex  u-col-center">
								<view class="item_one">
									<view class="item_num">{{ parseFloat(item.start_height / 10).toFixed(2) }}</view>
									<view class="item_text">开始高度 (m)</view>
								</view>
								<view class="item_one">
									<view class="item_num">{{ parseFloat(item.start_amplitude / 10).toFixed(2) }}</view>
									<view class="item_text">开始幅度 (m)</view>
								</view>
								<view class="item_one">
									<view class="item_num">{{ parseFloat(item.satrt_rotation / 10).toFixed(2) }}</view>
									<view class="item_text">开始回转 (°)</view>
								</view>
								<view class="item_one">
									<view class="item_num">{{ parseFloat(item.max_lifting_weight / 10).toFixed(2) }}
									</view>
									<view class="item_text">最大吊重 (kg)</view>
								</view>
							</view>
							<view class="cont_item u-flex  u-col-center">
								<view class="item_one">
									<view class="item_num">{{ parseFloat(item.end_height / 10).toFixed(2) }}</view>
									<view class="item_text">结束高度 (m)</view>
								</view>
								<view class="item_one">
									<view class="item_num">{{ parseFloat(item.end_amplitude / 10).toFixed(2) }}</view>
									<view class="item_text">结束幅度 (m)</view>
								</view>
								<view class="item_one">
									<view class="item_num">{{ parseFloat(item.end_rotation / 10).toFixed(2) }}</view>
									<view class="item_text">结束回转 (°)</view>
								</view>
								<view class="item_one">
									<view class="item_num">{{ item.max_moment }}</view>
									<view class="item_text">最大力矩 (%)</view>
								</view>
							</view>
							<view class="cont_times u-flex u-row-between u-col-center">
								<view class="time_box">
									<view class="title u-flex u-col-center u-row-center">
										<image src="/static/svg/task_clock.svg"></image>
										<text>开始时间</text>
									</view>
									<view class="time">{{ item.start_time }}</view>
								</view>
								<view class="time_line"></view>
								<view class="time_box">
									<view class="title u-flex u-col-center u-row-center">
										<image src="/static/svg/task_clock.svg"></image>
										<text>完成时间</text>
									</view>
									<view class="time">{{ item.end_time }}</view>
								</view>
							</view>
						</view>
					</view>
					<u-loadmore class="u-m-b-40 u-m-t-40" :status="loadStatus[1]" bgColor="#ffffff"></u-loadmore>
				</view>
				<u-empty style="width: 100%;height: 600rpx;" v-else text="没有更多数据" mode="list"></u-empty>
			</swiper-item>
			<!-- 基本信息 -->
			<swiper-item class="swiper_item">
				<view class="select_item u-p-l-66 u-p-r-66">
					<u-subsection :list="item" :current="curNow" @change="sectionChange" font-size="24" mode="button"
						bg-color="#E1E1E1" button-color="#569DFA" active-color="#ffffff" :bold="false"></u-subsection>
				</view>
				<view class="select_box" v-if="curNow == 0">
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">备案号：</view>
						<view class="item_right"><u-input v-model="tower.record_number" placeholder="请输入安监站设备备案号"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">安装位置：</view>
						<view class="item_right"><u-input v-model="tower.install_location" placeholder="请输入安装位置"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">司机姓名：</view>
						<view class="item_right"><u-input v-model="driverInfo.name" placeholder="请输入司机姓名"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">司机联系电话：</view>
						<view class="item_right"><u-input v-model="driverInfo.phone" placeholder="请输入联系电话"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">司机身份证号：</view>
						<view class="item_right"><u-input v-model="driverInfo.idcard" placeholder="请输入司机身份证号"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">司机操作证书编号：</view>
						<view class="item_right"><u-input v-model="driverInfo.certificateNo" placeholder="请输入司机操作证号"
								input-align="right" /></view>
					</view>
					<view class="field_item pic u-flex u-row-between u-col-bottom">
						<view class="item_left">司机可见光照片：</view>
						<view class="item_right u-flex u-row-right u-col-center">
							<view class="add_pic u-flex u-col-center u-row-center"
								@tap="$u.throttle(fnChooseImage, APP.during)">
								<image class="photo" v-if="driverInfo.photo" :src="driverInfo.photo"></image>
								<image v-else src="/static/svg/add_pic.svg"></image>
							</view>
						</view>
					</view>
				</view>
				<view class="select_box" v-if="curNow == 1">
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">倍率：</view>
						<view class="item_right"><u-input v-model="eqptParameter.ropeRatio" placeholder="请输入设备倍率"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">塔机型号：</view>
						<view class="item_right"><u-input v-model="eqptParameter.craneType" placeholder="请输入塔机型号"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">起重臂高：</view>
						<view class="item_right"><u-input v-model="eqptParameter.craneArmHeight"
								placeholder="请输入起重臂高度(m)" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">起重臂长：</view>
						<view class="item_right"><u-input v-model="eqptParameter.craneArmLength"
								placeholder="请输入起重臂长度(m)" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">塔帽高度：</view>
						<view class="item_right"><u-input v-model="eqptParameter.towerHatHeight"
								placeholder="请输入塔帽高度(m)" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">平衡臂长：</view>
						<view class="item_right"><u-input v-model="eqptParameter.balanceArmLength"
								placeholder="请输入平衡臂长度(m)" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">最大力矩：</view>
						<view class="item_right"><u-input v-model="eqptParameter.maxMoment" placeholder="请输入最大力矩"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">最大吊重：</view>
						<view class="item_right"><u-input v-model="eqptParameter.maxLiftingWeight" placeholder="请输入最大吊重"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">最大幅度吊重：</view>
						<view class="item_right"><u-input v-model="eqptParameter.maxExtentWeight"
								placeholder="请输入最大幅度支持的最大吊重" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">塔机X坐标：</view>
						<view class="item_right"><u-input v-model="eqptParameter.locationX" placeholder="请输入塔机X坐标"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">塔机Y坐标：</view>
						<view class="item_right"><u-input v-model="eqptParameter.locationY" placeholder="请输入塔机Y坐标"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">安装经度：</view>
						<view class="item_right"><u-input v-model="eqptParameter.longitude" placeholder="请输入安装经度"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">安装纬度：</view>
						<view class="item_right"><u-input v-model="eqptParameter.latitude" placeholder="请输入安装纬度"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">指北角度：</view>
						<view class="item_right"><u-input v-model="eqptParameter.pointNorthAngle" placeholder="请输入指北角度"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">左转最大角度：</view>
						<view class="item_right"><u-input v-model="eqptParameter.leftAngleLimit" placeholder="请输入左转最大角度"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">右转最大角度：</view>
						<view class="item_right"><u-input v-model="eqptParameter.rightAngleLimit"
								placeholder="请输入右转最大角度" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">最远前端距离：</view>
						<view class="item_right"><u-input v-model="eqptParameter.remoteLimit"
								placeholder="请输入小车最远点离塔臂距离" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">最近前端距离：</view>
						<view class="item_right"><u-input v-model="eqptParameter.nearLimit" placeholder="请输入小车最近点离塔臂距离"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">最高塔臂距离：</view>
						<view class="item_right"><u-input v-model="eqptParameter.highLimit" placeholder="请输入吊钩最高点离塔臂距离"
								input-align="right" /></view>
					</view>
				</view>
				<view class="select_box" v-if="curNow == 2">
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">保护区类型：</view>
						<view class="item_right">
							<view @tap="isShowProtection = true">{{ selectProtectionType }}</view>
						</view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">保护区名称：</view>
						<view class="item_right"><u-input v-model="protectionZone.name" placeholder="请输入保护区名称"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">建筑设施类型：</view>
						<view class="item_right">
							<view @tap="isShowFacilities = true">{{ selectFacilitiesType }}</view>
						</view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">保护区X坐标：</view>
						<view class="item_right"><u-input v-model="protectionZone.x" placeholder="请输入保护区X坐标"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">保护区Y坐标：</view>
						<view class="item_right"><u-input v-model="protectionZone.y" placeholder="请输入保护区Y坐标"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">保护区宽度：</view>
						<view class="item_right"><u-input v-model="protectionZone.width" placeholder="请输入保护区平面宽度(m)"
								input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">保护区高度：</view>
						<view class="item_right"><u-input v-model="protectionZone.height" placeholder="请输入保护区平面高度(m)"
								input-align="right" /></view>
					</view>
				</view>
				<view class="btn_box u-p-l-74 u-p-r-74">
					<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
						@tap="fnSaveCraneBaseInfo">保存</u-button>
				</view>
			</swiper-item>
			<!-- 标定 -->
			<swiper-item class="swiper_item" v-if="eqptInfo.isCalibration">
				<view class="select_item u-p-l-66 u-p-r-66">
					<u-subsection :list="demarcate" :current="curDemarcate" @change="demarcateChange" font-size="24"
						mode="button" bg-color="#E1E1E1" button-color="#569DFA" active-color="#ffffff"
						:bold="false"></u-subsection>
				</view>
				<!-- 重量 -->
				<view class="select_box" v-if="curDemarcate == 0">
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际重量1：</view>
						<view class="item_right"><u-input type="number" v-model="weightInfo.actual1"
								placeholder="请输入实际重量1" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际值1：</view>
						<view class="item_right"><u-input type="number" v-model="weightInfo.calibration1"
								placeholder="请输入实际值1" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际重量2：</view>
						<view class="item_right"><u-input type="number" v-model="weightInfo.actual2"
								placeholder="请输入实际重量2" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际值2：</view>
						<view class="item_right"><u-input type="number" v-model="weightInfo.calibration2"
								placeholder="请输入实际值2" input-align="right" /></view>
					</view>
					<view class="u-flex u-row-between u-p-l-40 u-p-r-40">
						<view class="btn_box margin_10 u-p-l-10 u-p-r-10">
							<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
								@tap="fnGetCalibrationParam(1, 1)">获取实际值1</u-button>
						</view>
						<view class="btn_box margin_10 u-p-l-10 u-p-r-10">
							<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
								@tap="fnGetCalibrationParam(1, 2)">获取实际值2</u-button>
						</view>
					</view>
					<view class="btn_box margin_10 u-p-l-50 u-p-r-50">
						<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
							@tap="fnSendCalibrationParam(1)">保存重量标定</u-button>
					</view>
				</view>
				<!-- 高度 -->
				<view class="select_box" v-if="curDemarcate == 1">
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际高度1：</view>
						<view class="item_right"><u-input type="number" v-model="heightInfo.actual1"
								placeholder="请输入实际高度1" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际值1：</view>
						<view class="item_right"><u-input type="number" v-model="heightInfo.calibration1"
								placeholder="请输入实际值1" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际高度2：</view>
						<view class="item_right"><u-input type="number" v-model="heightInfo.actual2"
								placeholder="请输入实际高度2" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际值2：</view>
						<view class="item_right"><u-input type="number" v-model="heightInfo.calibration2"
								placeholder="请输入实际值2" input-align="right" /></view>
					</view>
					<view class="u-flex u-row-between u-p-l-40 u-p-r-40">
						<view class="btn_box margin_10 u-p-l-10 u-p-r-10">
							<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
								@tap="fnGetCalibrationParam(2, 1)">获取实际值1</u-button>
						</view>
						<view class="btn_box margin_10 u-p-l-10 u-p-r-10">
							<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
								@tap="fnGetCalibrationParam(2, 2)">获取实际值2</u-button>
						</view>
					</view>
					<view class="btn_box margin_10 u-p-l-50 u-p-r-50">
						<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
							@tap="fnSendCalibrationParam(2)">保存高度标定</u-button>
					</view>
				</view>
				<!-- 幅度 -->
				<view class="select_box" v-if="curDemarcate == 2">
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际位置1：</view>
						<view class="item_right"><u-input type="number" v-model="rangeInfo.actual1"
								placeholder="请输入实际位置1" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际值1：</view>
						<view class="item_right"><u-input type="number" v-model="rangeInfo.calibration1"
								placeholder="请输入实际值1" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际位置2：</view>
						<view class="item_right"><u-input type="number" v-model="rangeInfo.actual2"
								placeholder="请输入实际位置2" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际值2：</view>
						<view class="item_right"><u-input type="number" v-model="rangeInfo.calibration2"
								placeholder="请输入实际值2" input-align="right" /></view>
					</view>
					<view class="u-flex u-row-between u-p-l-40 u-p-r-40">
						<view class="btn_box margin_10 u-p-l-10 u-p-r-10">
							<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
								@tap="fnGetCalibrationParam(3, 1)">获取实际值1</u-button>
						</view>
						<view class="btn_box margin_10 u-p-l-10 u-p-r-10">
							<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
								@tap="fnGetCalibrationParam(3, 2)">获取实际值2</u-button>
						</view>
					</view>
					<view class="btn_box margin_10 u-p-l-50 u-p-r-50">
						<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
							@tap="fnSendCalibrationParam(3)">保存幅度标定</u-button>
					</view>
				</view>
				<!-- 回转 -->
				<view class="select_box" v-if="curDemarcate == 3">
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际转角1：</view>
						<view class="item_right"><u-input type="number" v-model="rotationInfo.actual1"
								placeholder="请输入实际转角1" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际值1：</view>
						<view class="item_right"><u-input type="number" v-model="rotationInfo.calibration1"
								placeholder="请输入实际值1" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际转角2：</view>
						<view class="item_right"><u-input type="number" v-model="rotationInfo.actual2"
								placeholder="请输入实际转角2" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">实际值2：</view>
						<view class="item_right"><u-input type="number" v-model="rotationInfo.calibration2"
								placeholder="请输入实际值2" input-align="right" /></view>
					</view>
					<view class="u-flex u-row-between u-p-l-40 u-p-r-40">
						<view class="btn_box margin_10 u-p-l-10 u-p-r-10">
							<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
								@tap="fnGetCalibrationParam(4, 1)">获取实际值1</u-button>
						</view>
						<view class="btn_box margin_10 u-p-l-10 u-p-r-10">
							<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
								@tap="fnGetCalibrationParam(4, 2)">获取实际值2</u-button>
						</view>
					</view>
					<view class="btn_box margin_10 u-p-l-50 u-p-r-50">
						<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
							@tap="fnSendCalibrationParam(4)">保存回转标定</u-button>
					</view>
				</view>
				<!-- 倾角 -->
				<view class="select_box" v-if="curDemarcate == 4">
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">X轴实际角度1：</view>
						<view class="item_right"><u-input type="number" v-model="dipInfo.actual1"
								placeholder="请输入X轴实际角度1" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">Y轴实际角度1：</view>
						<view class="item_right"><u-input type="number" v-model="dipInfo.calibration1"
								placeholder="请输入Y轴实际角度1" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">X轴实际角度2：</view>
						<view class="item_right"><u-input type="number" v-model="dipInfo.actual2"
								placeholder="请输入X轴实际角度2" input-align="right" /></view>
					</view>
					<view class="field_item u-flex u-row-between u-col-bottom">
						<view class="item_left">Y轴实际角度2：</view>
						<view class="item_right"><u-input type="number" v-model="dipInfo.calibration2"
								placeholder="请输入Y轴实际角度2" input-align="right" /></view>
					</view>
					<view class="u-flex u-row-between u-p-l-40 u-p-r-40">
						<view class="btn_box margin_10 u-p-l-10 u-p-r-10">
							<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
								@tap="fnGetCalibrationParam(5, 1)">获取实际角度1</u-button>
						</view>
						<view class="btn_box margin_10 u-p-l-10 u-p-r-10">
							<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
								@tap="fnGetCalibrationParam(5, 2)">获取实际角度2</u-button>
						</view>
					</view>
					<view class="btn_box margin_10 u-p-l-50 u-p-r-50">
						<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
							@tap="fnSendCalibrationParam(5)">保存倾角标定</u-button>
					</view>
				</view>
			</swiper-item>
			<!-- 基本配置 -->
			<swiper-item class="swiper_item" v-if="eqptInfo.isCalibration">
				<view class="u-p-l-40 u-p-r-40 u-font-32">塔机信息</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">塔机类型：</view>
					<view class="item_right">
						<u-radio-group v-model="setInfo.type">
							<u-radio name="0">尖塔</u-radio>
							<u-radio name="1">平塔</u-radio>
						</u-radio-group>
					</view>
				</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">塔机型号：</view>
					<view class="item_right"><u-input v-model="setInfo.model" disabled placeholder="塔机型号"
							input-align="right" /></view>
				</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">大臂长度(m)：</view>
					<view class="item_right"><u-input type="number" v-model="setInfo.craneArmLength"
							placeholder="请输入大臂长度" input-align="right" /></view>
				</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">吊绳倍率：</view>
					<view class="item_right">
						<u-radio-group v-model="setInfo.slingRatio">
							<u-radio name="2">2</u-radio>
							<u-radio name="4">4</u-radio>
							<u-radio name="6">6</u-radio>
							<u-radio name="8">8</u-radio>
						</u-radio-group>
					</view>
				</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">平衡臂长(m)：</view>
					<view class="item_right"><u-input type="number" v-model="setInfo.balanceArmLength"
							placeholder="请输入平衡臂长" input-align="right" /></view>
				</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">最大载重(t)：</view>
					<view class="item_right"><u-input type="number" v-model="setInfo.maxLiftingWeight"
							placeholder="请输入最大载重" input-align="right" /></view>
				</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">塔帽高度(m)：</view>
					<view class="item_right"><u-input type="number" v-model="setInfo.towerHatHeight"
							placeholder="请输入塔帽高度" input-align="right" /></view>
				</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">最大力矩(KN*m)：</view>
					<view class="item_right"><u-input type="number" v-model="setInfo.maxTorque" placeholder="请输入最大力矩"
							input-align="right" /></view>
				</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">塔身高度(m)：</view>
					<view class="item_right"><u-input type="number" v-model="setInfo.craneArmHeight"
							placeholder="请输入塔身高度" input-align="right" /></view>
				</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">最大风速(m/s)：</view>
					<view class="item_right"><u-input type="number" v-model="setInfo.maxwindSpeed" placeholder="请输入最大风速"
							input-align="right" /></view>
				</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">系统时间：</view>
					<view class="item_right"><u-input v-model="setInfo.time" disabled placeholder="请输入系统时间"
							input-align="right" /></view>
				</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">SIM：</view>
					<view class="item_right"><u-input v-model="setInfo.SIM" disabled placeholder="请输入SIM"
							input-align="right" /></view>
				</view>
				<view class="u-p-l-40 u-p-r-40 u-font-32 u-m-t-20 u-flex u-row-between">
					<span>安装信息</span>
					<view>
						<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="primary" size="mini"
							@tap="fnGetLocation">获取经纬度</u-button>
					</view>
				</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">经度：</view>
					<view class="item_right"><u-input type="number" v-model="setInfo.installationLongitude"
							placeholder="请输入经度" input-align="right" /></view>
				</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">纬度：</view>
					<view class="item_right"><u-input type="number" v-model="setInfo.installationLatitude"
							placeholder="请输入纬度" input-align="right" /></view>
				</view>
				<view class="field_item u-flex u-row-between u-col-bottom">
					<view class="item_left">正北偏转：</view>
					<view class="item_right"><u-input type="number" v-model="setInfo.dueNorthDeflection"
							placeholder="请输入正北偏转" input-align="right" /></view>
				</view>
				<view class="btn_box margin_10 u-p-l-50 u-p-r-50">
					<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
						@tap="fnSendBasicParamConfig">保存设置</u-button>
				</view>
			</swiper-item>
		</swiper>
		<!-- 搜索 历史记录-->
		<u-popup v-model="isShowHistory" mode="right" z-index="10077" width="600rpx" border-radius="10">
			<view class="popup_title u-flex u-row-between">
				<view class="text">筛选</view>
				<view class="close u-flex u-row-center u-col-center" @tap="isShowHistory = false">
					<image src="/static/svg/close.svg"></image>
				</view>
			</view>
			<view class="popup_field u-flex">
				<view class="item u-flex u-row-right u-col-center">是否报警</view>
				<view class="item u-flex u-row-center u-col-center">
					<u-radio-group v-model="history.is_alarm">
						<u-radio shape="circle" name="0">未预报警</u-radio>
						<u-radio shape="circle" name="1">预报警</u-radio>
					</u-radio-group>
				</view>
			</view>
			<view class="popup_field u-flex">
				<view class="item u-flex u-row-center u-col-center">创建时间</view>
				<view class="item u-flex u-row-left u-col-center">
					<text @tap="isTimeshow = true">{{ history.create_at }}</text>
				</view>
			</view>
			<view class="u-flex u-row-between">
				<view class="btn_box u-p-l-20 u-p-r-20 u-m-t-20">
					<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
						@tap="fnResetHistory">重置</u-button>
				</view>
				<view class="btn_box u-p-l-20 u-p-r-20 u-m-t-20">
					<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
						@tap="fnSearchHistory">搜索</u-button>
				</view>
			</view>
		</u-popup>
		<!-- 搜索 吊装记录-->
		<u-popup v-model="isShowHoist" mode="right" z-index="10077" width="600rpx" border-radius="10">
			<view class="popup_title u-flex u-row-between">
				<view class="text">筛选</view>
				<view class="close u-flex u-row-center u-col-center" @tap="isShowHoist = false">
					<image src="/static/svg/close.svg"></image>
				</view>
			</view>
			<view class="popup_field u-flex">
				<view class="item u-flex u-row-center u-col-center">创建时间</view>
				<view class="item u-flex u-row-left u-col-center">
					<text @tap="isTimeshow = true">{{ hoisting.create_at }}</text>
				</view>
			</view>
			<view class="u-flex u-row-between">
				<view class="btn_box u-p-l-20 u-p-r-20 u-m-t-20">
					<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
						@tap="fnResetHoist">重置</u-button>
				</view>
				<view class="btn_box u-p-l-20 u-p-r-20 u-m-t-20">
					<u-button :ripple="true" :hair-line="false" ripple-bg-color="#a0cfff" type="default"
						@tap="fnSearchHoist">搜索</u-button>
				</view>
			</view>
		</u-popup>
		<!-- 更多 弹窗 -->
		<u-popup v-model="isMore" style="margin-top: 90rpx;" :closeable="true" mode="top" height="750rpx"
			border-radius="24">
			<More @fnClose="isMore = false"></More>
		</u-popup>
		<!-- 保护区类型选择 -->
		<u-select z-index="11000" v-model="isShowProtection" mode="single-column" :list="protectionType"
			@confirm="fnSelectProtectionType"></u-select>
		<!-- 建筑设置类型选择 -->
		<u-select z-index="11000" v-model="isShowFacilities" mode="single-column" :list="facilitiesType"
			@confirm="fnSelectFacilitiesType"></u-select>
		<!-- 搜索 消息通知 时间插件 -->
		<u-calendar z-index="11000" v-if="isTimeshow" v-model="isTimeshow" mode="range" max-date="2100-12-31"
			@change="fnChangeTime"></u-calendar>
		<!-- 正在加载 loading -->
		<view class="loading u-flex u-row-center u-col-center">
			<u-loading :show="isLoading" mode="flower" size="72"></u-loading>
		</view>
	</view>
</template>

<script>
	import uCharts from '@/components/u-charts/u-charts.js';

	var _self;
	var canvasObj = {};
	const {
		windowWidth,
		windowHeight,
		model
	} = uni.getSystemInfoSync();
	export default {
		data() {
			return {
				isLoading: false, // 是否加载
				eqptInfo: {},
				cycleCount: 0, //吊装次数
				alarmCount: 0, // 预报警次数
				safeCount: 0, // 安全运行率
				firstInfo: {}, // 第一条实时数据
				infoList: [], // 统计图数据
				tabTotal: {}, // 实时统计图
				cWidth: '',
				cHeight: '',
				pixelRatio: 1,
				isMore: false, // 更多
				tabList: [{
					name: '数据统计'
				}, {
					name: '历史实时数据'
				}, {
					name: '吊装记录'
				}, {
					name: '基本信息'
				}, {
					name: '标定'
				}, {
					name: '基本配置'
				}],
				tabList1: [{
					name: '数据统计'
				}, {
					name: '历史实时数据'
				}, {
					name: '吊装记录'
				}, {
					name: '基本信息'
				}],
				tabCurrent: 0,
				tabSwiper: 0,
				item: [{
					name: '基本信息'
				}, {
					name: '设备信息'
				}, {
					name: '设备保护区'
				}],
				curNow: 0,
				tower: {
					// 塔机 绑定数据
					record_number: '', // 备案号
					install_location: '' // 安装位置
				},
				driverInfo: {
					// 司机信息 ---- 塔机
					name: '', // 司机姓名
					phone: '', // 司机电话
					idcard: '', // 司机身份证号
					photo: '', // 司机照片
					certificateNo: '' // 操作证号
				},
				eqptParameter: {
					// 设备信息 ---- 塔机
					ropeRatio: 2, // 设备倍率
					craneType: '', // 塔机型号
					craneArmHeight: '', // 起重臂高度
					craneArmLength: '', // 起重臂长度
					towerHatHeight: '', // 塔帽高度
					balanceArmLength: '', // 平衡臂长
					maxMoment: '', // 最大力矩
					maxLiftingWeight: '', // 最大吊重
					maxExtentWeight: '', // 最大幅度吊重
					locationX: '', // 塔机X坐标
					locationY: '', // 塔机Y坐标
					longitude: '', // 安装经度
					latitude: '', // 安装纬度
					pointNorthAngle: '', // 指北角度
					leftAngleLimit: '', // 左转最大角度
					rightAngleLimit: '', // 右转最大角度
					remoteLimit: '', // 最远前端距离
					nearLimit: '', // 最近前端距离
					highLimit: '' // 最高塔臂距离
				},
				protectionZone: {
					// 设备保护区 ----塔机
					type: '', // 保护区类型
					name: '', // 保护区名称
					buildingType: '', // 建筑设施类型
					x: '', // 保护区X坐标
					y: '', // 保护区Y坐标
					width: '', // 保护区宽度
					height: '' // 保护区高度
				},
				isShowProtection: false, // 保护区类型下拉列表
				selectProtectionType: '请选择保护区类型', // 选中的保护区类型
				protectionType: [{
					value: '0',
					label: '禁行区'
				}, {
					value: '1',
					label: '障碍物'
				}], // 保护区类型列表
				isShowFacilities: false, // 建筑设施类型
				selectFacilitiesType: '请选择建筑设施类型', // 选中的建筑设施类型
				facilitiesType: [{
						value: '0',
						label: '其他'
					},
					{
						value: '1',
						label: '医院'
					},
					{
						value: '2',
						label: '学校'
					},
					{
						value: '3',
						label: '广场'
					},
					{
						value: '4',
						label: '道路'
					},
					{
						value: '5',
						label: '居民区'
					},
					{
						value: '6',
						label: '办公区'
					},
					{
						value: '7',
						label: '高压线'
					}
				], // 建筑设施类型列表
				height: 880 * this.APP.ratio,
				totalHeight: 1305 * this.APP.ratio, // 数据统计页面高度
				historyHeight: windowHeight - 100, // 历史实时数据页面高度
				hoistHeight: windowHeight - 100, // 吊装记录页面高度
				baseHeight: 700 * this.APP.ratio, // 基本信息页面高度
				demarcateHeight: windowHeight - 100, // 标定页面高度
				baseConfigHeight: 1020 * this.APP.ratio, // 基本配置页面高度
				historyNoMore: false, // 历史实时数据没有更多
				hoistNoMore: false, // 吊装记录数据没有更多
				loadStatus: ['loadmore', 'loadmore'],
				historyList: [], // 历史实时数据
				hoistList: [], // 吊装记录数据
				isShowHistory: false, // 搜索弹窗
				isTimeshow: false, // 创建时间插件
				history: {
					// 历史实时记录页数
					is_alarm: '', // 0->否 1->是
					create_at: '选择创建时间',
					page: 0,
					size: 8
				},
				isShowHoist: false, // 搜索弹窗
				hoisting: {
					// 吊装记录页数
					create_at: '选择创建时间',
					page: 0,
					size: 8
				},
				baseInfo: {}, // 塔机基本信息
				demarcate: [{
					name: '重量'
				}, {
					name: '高度'
				}, {
					name: '幅度'
				}, {
					name: '回转'
				}, {
					name: '倾角'
				}],
				curDemarcate: 0,
				weightInfo: {
					// 重量
					actual1: '', // 实际重量1
					calibration1: '', // 实际值1
					actual2: '', // 实际重量2
					calibration2: '' // 实际值2
				},
				heightInfo: {
					// 高度
					actual1: '', // 实际高度1
					calibration1: '', // 实际值1
					actual2: '', // 实际高度2
					calibration2: '' // 实际值2
				},
				rangeInfo: {
					// 幅度
					actual1: '', // 实际位置1
					calibration1: '', // 实际值1
					actual2: '', // 实际位置2
					calibration2: '' // 实际值2
				},
				rotationInfo: {
					// 回转
					actual1: '', // 实际转角1
					calibration1: '', // 实际值1
					actual2: '', // 实际转角2
					calibration2: '' // 实际值2
				},
				dipInfo: {
					// 倾角
					actual1: '', // x轴实际角度1
					calibration1: '', // y轴实际角度1
					actual2: '', // x轴实际角度2
					calibration2: '' // y轴实际角度2
				},
				setInfo: {
					time: '', //系统时间戳
					type: '', // 塔机类型 0尖塔1平塔
					craneArmLength: '', // 大臂长度 2位小数
					balanceArmLength: '', // 平衡长度 2位小数
					towerHatHeight: '', // 塔帽高度 2位小数
					craneArmHeight: '', // 塔身高度 2位小数
					model: '', // 塔机型号
					slingRatio: '', // 吊绳倍率 2/4/6/8
					maxLiftingWeight: '', // 最大载重 2位小数
					maxTorque: '', // 最大力矩 2位小数
					maxwindSpeed: '', // 最大风速 2位小数
					installationLongitude: '', // 经度 6位小数
					installationLatitude: '', // 纬度 6位小数
					dueNorthDeflection: '', // 正北偏转 2位小数
					SIM: '' // sim
				}
			};
		},
		onLoad: function(option) {
			this.eqptInfo = JSON.parse(decodeURIComponent(option.item));
			_self = this;
			this.cWidth = uni.upx2px(700);
			this.cHeight = uni.upx2px(1600);

			this.fnInit();
		},

		// 下拉刷新
		onPullDownRefresh() {
			let that = this;
			setTimeout(function() {
				uni.stopPullDownRefresh();
				that.fnInit();
			}, 100);
		},
		// 触底加载更多
		onReachBottom() {
			let that = this;
			if (that.tabCurrent == 1) {
				// 历史实时记录
				if (that.historyNoMore) return;
				that.loadStatus.splice(0, 1, 'loading');
				setTimeout(function() {
					that.fnGetHistoryList();
				}, 100);
			} else if (that.tabCurrent == 2) {
				// 吊装记录
				if (that.hoistNoMore) return;
				that.loadStatus.splice(1, 1, 'loading');
				setTimeout(function() {
					that.fnGetHoistList();
				}, 100);
			}
		},
		methods: {
			// 返回上一页
			fnReturn() {
				uni.navigateBack({
					delta: 1,
					animationType: 'pop-out',
					animationDuration: 200
				});
			},
			// 初始化
			fnInit() {
				this.historyNoMore = false;
				this.hoistNoMore = false;
				this.history.page = 0;
				this.hoisting.page = 0;
				this.historyList = [];
				this.hoistList = [];
				
				// todo启动连接websocket
				
				this.fnGetEqptInfo();
				this.fnGetHistoryList();
				this.fnGetHoistList();
				this.fnResetBaseInfo(); // 重置基本信息
				this.fnGetBaseInfo();
				if (this.eqptInfo.isCalibration) {
					this.fnGetBasicParamConfig(); // 基本配置
				}
			},
			// 重置基本信息数据
			fnResetBaseInfo() {
				for (let i in this.driverInfo) {
					this.driverInfo[i] = '';
				}
				for (let j in this.eqptParameter) {
					this.eqptParameter[j] = '';
				}
				for (let k in this.protectionZone) {
					this.protectionZone[k] = '';
				}
				this.eqptParameter.ropeRatio = 2;
				this.selectProtectionType = '请选择保护区类型'; // 选中的保护区类型
				this.selectFacilitiesType = '请选择建筑设施类型'; // 选中的建筑设施类型
			},
			// 获取页面初始化数据 设备信息
			fnGetEqptInfo() {

				// 模拟数据，应后端获取
				let res =
					'{"list":[{"id":8499,"height":1122,"amplitude":448,"rotation":3133,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:12:43","create_at":"2024-07-06 15:12:45"},{"id":8498,"height":1122,"amplitude":446,"rotation":3133,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:12:23","create_at":"2024-07-06 15:12:25"},{"id":8497,"height":1123,"amplitude":446,"rotation":3124,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:12:03","create_at":"2024-07-06 15:12:06"},{"id":8496,"height":1122,"amplitude":446,"rotation":3124,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:11:43","create_at":"2024-07-06 15:11:46"},{"id":8495,"height":1123,"amplitude":446,"rotation":3124,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:11:23","create_at":"2024-07-06 15:11:26"},{"id":8494,"height":1138,"amplitude":446,"rotation":3124,"load":400,"safe_load":9000,"torque_percentage":6,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:11:04","create_at":"2024-07-06 15:11:07"},{"id":8493,"height":1172,"amplitude":431,"rotation":3142,"load":660,"safe_load":9000,"torque_percentage":9,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:10:44","create_at":"2024-07-06 15:10:46"},{"id":8492,"height":1135,"amplitude":363,"rotation":3320,"load":750,"safe_load":9000,"torque_percentage":10,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:10:24","create_at":"2024-07-06 15:10:26"},{"id":8491,"height":1040,"amplitude":363,"rotation":3329,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:10:04","create_at":"2024-07-06 15:10:06"},{"id":8490,"height":1042,"amplitude":363,"rotation":3329,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:09:44","create_at":"2024-07-06 15:09:46"},{"id":8489,"height":1040,"amplitude":365,"rotation":3329,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:09:24","create_at":"2024-07-06 15:09:27"},{"id":8488,"height":1040,"amplitude":365,"rotation":3339,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:09:04","create_at":"2024-07-06 15:09:07"},{"id":8487,"height":1111,"amplitude":322,"rotation":3339,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:08:45","create_at":"2024-07-06 15:08:47"},{"id":8486,"height":1188,"amplitude":265,"rotation":3581,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:08:25","create_at":"2024-07-06 15:08:27"},{"id":8485,"height":1190,"amplitude":183,"rotation":579,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:08:05","create_at":"2024-07-06 15:08:07"}],"allCount":1782,"alarmCount":0,"cycleCount":29}';
				let data = JSON.parse(res)

				console.log(res)

				this.cycleCount = data.cycleCount; // 吊装次数
				this.alarmCount = data.alarmCount; // 报警实时记录总数
				let allCount = data.allCount; // 实时记录总数
				if (this.alarmCount == 0) {
					this.safeCount = 100;
				} else {
					this.safeCount = allCount != 0 ? parseInt(this.APP.fnTwoFloat((allCount - this.alarmCount) /
						allCount) * 100) : 0;
				}
				let dataList = data.list;
				if (dataList.length > 0) {
					this.infoList = dataList;
					this.firstInfo = dataList[0];
					let _tabTotal = {};
					let _tabTotalCategories = []; // X轴数据
					let _tabTotalSeries = []; // Y轴数据
					let _tabTotalData1 = []; // Y轴内容 高度
					let _tabTotalData2 = []; // Y轴内容 幅度
					let _tabTotalData3 = []; // Y轴内容 载重
					let _tabTotalData4 = []; // Y轴内容 风速
					let _tabTotalData5 = []; // Y轴内容 倾角
					for (let n in dataList) {
						// 整改走势数据组装
						_tabTotalCategories.push(dataList[n].record_at.split(' ')[1]);
						_tabTotalData1.push(dataList[n].height);
						_tabTotalData2.push(dataList[n].amplitude);
						_tabTotalData3.push(dataList[n].load);
						_tabTotalData4.push(dataList[n].wind_speed);
						_tabTotalData5.push(dataList[n].tilt);
					}
					_tabTotalSeries = [{
							color: '#1890ff',
							data: _tabTotalData1,
							name: '高度'
						},
						{
							color: '#facc14',
							data: _tabTotalData2,
							name: '幅度'
						},
						{
							color: '#f04864',
							data: _tabTotalData3,
							name: '载重'
						},
						{
							color: '#2fc25b',
							data: _tabTotalData4,
							name: '风速'
						},
						{
							color: '#8543e0',
							data: _tabTotalData5,
							name: '倾角'
						}
					];
					_tabTotal = {
						categories: _tabTotalCategories,
						series: _tabTotalSeries
					};
					this.tabTotal = _tabTotal;
					setTimeout(() => {
						this.fnShowTabLine('canvasLineB', this.tabTotal);
					}, 500);
				} else {
					this.infoList = [];
					this.firstInfo = {};
				}

			},
			// 跳转历史实时数据页面 并搜索预报警数据
			fnGoHistory() {
				this.tabSwiper = 1;
				this.history.is_alarm = '1';
				this.fnSearchHistory();
			},
			// 跳转吊装记录页面
			fnGoHoist() {
				this.tabSwiper = 2;
			},
			// 打开搜索弹窗
			fnSearchShow() {
				if (this.tabCurrent == 1) {
					this.isShowHistory = true;
				}
				if (this.tabCurrent == 2) {
					this.isShowHoist = true;
				}
			},
			// 重置历史记录搜索
			fnResetHistory() {
				this.history.is_alarm = '';
				this.history.create_at = '选择创建时间';
			},
			// 获取历史实时数据
			fnGetHistoryList() {
				this.history.page += 1;
				this.history.number = this.eqptInfo.number;
				let _obj = JSON.parse(JSON.stringify(this.history));
				if (_obj.create_at == '选择创建时间') {
					_obj.create_at = '';
				}

				// 模拟数据，应后端获取
				let res =
					'{"list":[{"id":8499,"height":1122,"amplitude":448,"rotation":3133,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:12:43","create_at":"2024-07-06 15:12:45"},{"id":8498,"height":1122,"amplitude":446,"rotation":3133,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:12:23","create_at":"2024-07-06 15:12:25"},{"id":8497,"height":1123,"amplitude":446,"rotation":3124,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:12:03","create_at":"2024-07-06 15:12:06"},{"id":8496,"height":1122,"amplitude":446,"rotation":3124,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:11:43","create_at":"2024-07-06 15:11:46"},{"id":8495,"height":1123,"amplitude":446,"rotation":3124,"load":0,"safe_load":9000,"torque_percentage":0,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:11:23","create_at":"2024-07-06 15:11:26"},{"id":8494,"height":1138,"amplitude":446,"rotation":3124,"load":400,"safe_load":9000,"torque_percentage":6,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:11:04","create_at":"2024-07-06 15:11:07"},{"id":8493,"height":1172,"amplitude":431,"rotation":3142,"load":660,"safe_load":9000,"torque_percentage":9,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:10:44","create_at":"2024-07-06 15:10:46"},{"id":8492,"height":1135,"amplitude":363,"rotation":3320,"load":750,"safe_load":9000,"torque_percentage":10,"wind_speed":0,"tilt":0,"status":"00000000","record_at":"2024-07-06 15:10:24","create_at":"2024-07-06 15:10:26"}],"page":1}'
				let data = JSON.parse(res)

				let _data = data.list;
				if (_data.length < this.history.size) {
					this.historyNoMore = true;
					this.loadStatus.splice(0, 1, 'nomore');
				} else {
					this.loadStatus.splice(0, 1, 'loadmore');
				}
				this.historyList = this.historyList.concat(_data);
				this.history.page = parseInt(data.page);
				this.historyHeight = parseInt(309 * this.historyList.length * this.APP.ratio) + parseInt(
					60 * this.APP.ratio);
				this.historyHeight = this.historyHeight > windowHeight - 100 ? this.historyHeight :
					windowHeight - 100;
				switch (parseInt(this.tabCurrent)) {
					case 0:
						this.height = this.totalHeight;
						break;
					case 1:
						this.height = this.historyHeight;
						break;
					case 2:
						this.height = this.hoistHeight;
						break;
					case 3:
						this.height = this.baseHeight;
						break;
					case 4:
						this.height = this.demarcateHeight;
						break;
					case 5:
						this.height = this.baseConfigHeight;
						break;
					default:
						break;
				}

			},
			// 搜索历史记录
			fnSearchHistory() {
				this.historyNoMore = false;
				this.history.page = 0;
				this.historyList = [];
				let _obj = JSON.parse(JSON.stringify(this.history));
				_obj.page += 1;
				_obj.number = this.eqptInfo.number;
				if (_obj.create_at == '选择创建时间') {
					_obj.create_at = '';
				}
				this.$u.api.$get('/crane/record', _obj, res => {
					if (res.code == 1) {
						let _data = res.data.list;
						if (_data.length < this.history.size) {
							this.historyNoMore = true;
							this.loadStatus.splice(0, 1, 'nomore');
						} else {
							this.loadStatus.splice(0, 1, 'loadmore');
						}
						this.historyList = _data;
						this.history.page = parseInt(res.data.page);
						this.historyHeight = parseInt(309 * this.historyList.length * this.APP.ratio) + parseInt(
							60 * this.APP.ratio);
						this.historyHeight = this.historyHeight > windowHeight - 100 ? this.historyHeight :
							windowHeight - 100;
						switch (parseInt(this.tabCurrent)) {
							case 0:
								this.height = this.totalHeight;
								break;
							case 1:
								this.height = this.historyHeight;
								break;
							case 2:
								this.height = this.hoistHeight;
								break;
							case 3:
								this.height = this.baseHeight;
								break;
							case 4:
								this.height = this.demarcateHeight;
								break;
							case 5:
								this.height = this.baseConfigHeight;
								break;
							default:
								break;
						}
					}
					this.isShowHistory = false;
				});
			},
			// 重置吊装记录
			fnResetHoist() {
				this.hoisting.create_at = '选择创建时间';
			},
			// 获取吊装记录数据
			fnGetHoistList() {
				this.hoisting.page += 1;
				this.hoisting.number = this.eqptInfo.number;
				let _obj = JSON.parse(JSON.stringify(this.hoisting));
				if (_obj.create_at == '选择创建时间') {
					_obj.create_at = '';
				}

				// 模拟数据，应后端获取
				let res =
					'{"list":[{"id":102,"start_time":"2024-07-06 15:19:47","start_height":"1048","start_amplitude":"340","satrt_rotation":"3487","end_time":"2024-07-06 15:20:06","end_height":1122,"end_amplitude":"444","end_rotation":"3151","max_lifting_weight":"520","max_moment":"1","create_at":"2024-07-06 15:20:08"},{"id":101,"start_time":"2024-07-06 15:15:24","start_height":"1127","start_amplitude":"446","satrt_rotation":"3123","end_time":"2024-07-06 15:17:32","end_height":1047,"end_amplitude":"173","end_rotation":"3478","max_lifting_weight":"240","max_moment":"27","create_at":"2024-07-06 15:17:36"},{"id":100,"start_time":"2024-07-06 15:10:59","start_height":"1045","start_amplitude":"362","satrt_rotation":"3329","end_time":"2024-07-06 15:11:29","end_height":1122,"end_amplitude":"446","end_rotation":"3123","max_lifting_weight":"850","max_moment":"9","create_at":"2024-07-06 15:11:32"},{"id":99,"start_time":"2024-07-06 15:04:29","start_height":"1102","start_amplitude":"201","satrt_rotation":"1092","end_time":"2024-07-06 15:04:52","end_height":1066,"end_amplitude":"299","end_rotation":"1447","max_lifting_weight":"400","max_moment":"16","create_at":"2024-07-06 15:04:54"},{"id":98,"start_time":"2024-07-06 14:57:27","start_height":"1091","start_amplitude":"144","satrt_rotation":"1503","end_time":"2024-07-06 14:58:00","end_height":1081,"end_amplitude":"275","end_rotation":"1475","max_lifting_weight":"110","max_moment":"12","create_at":"2024-07-06 14:58:02"},{"id":97,"start_time":"2024-07-06 14:21:22","start_height":"1102","start_amplitude":"210","satrt_rotation":"1101","end_time":"2024-07-06 14:21:50","end_height":1071,"end_amplitude":"225","end_rotation":"1680","max_lifting_weight":"300","max_moment":"5","create_at":"2024-07-06 14:21:53"},{"id":96,"start_time":"2024-07-06 14:18:06","start_height":"1094","start_amplitude":"392","satrt_rotation":"1690","end_time":"2024-07-06 14:18:24","end_height":1097,"end_amplitude":"325","end_rotation":"1699","max_lifting_weight":"450","max_moment":"21","create_at":"2024-07-06 14:18:26"},{"id":95,"start_time":"2024-07-06 10:40:30","start_height":"1071","start_amplitude":"253","satrt_rotation":"1755","end_time":"2024-07-06 10:40:52","end_height":1105,"end_amplitude":"203","end_rotation":"1111","max_lifting_weight":"260","max_moment":"1","create_at":"2024-07-06 10:40:54"}],"page":1}'
				let data = JSON.parse(res)

				let _data = data.list;
				if (_data.length < this.hoisting.size) {
					this.hoistNoMore = true;
					this.loadStatus.splice(1, 1, 'nomore');
				} else {
					this.loadStatus.splice(1, 1, 'loadmore');
				}
				this.hoistList = this.hoistList.concat(_data);
				this.hoisting.page = parseInt(data.page);
				let _height = this.APP.ratio > 1.1 ? 291 : 289;
				this.hoistHeight = parseInt(_height * this.hoistList.length * this.APP.ratio) + parseInt(
					60 * this.APP.ratio);
				this.hoistHeight = this.hoistHeight > windowHeight - 100 ? this.hoistHeight :
					windowHeight - 100;
				switch (parseInt(this.tabCurrent)) {
					case 0:
						this.height = this.totalHeight;
						break;
					case 1:
						this.height = this.historyHeight;
						break;
					case 2:
						this.height = this.hoistHeight;
						break;
					case 3:
						this.height = this.baseHeight;
						break;
					case 4:
						this.height = this.demarcateHeight;
						break;
					case 5:
						this.height = this.baseConfigHeight;
						break;
					default:
						break;
				}

			},
			// 搜索 吊装记录
			fnSearchHoist() {
				this.hoisting.page = 0;
				this.hoistNoMore = false;
				this.hoistList = [];
				let _obj = JSON.parse(JSON.stringify(this.hoisting));
				_obj.page += 1;
				_obj.number = this.eqptInfo.number;
				if (_obj.create_at == '选择创建时间') {
					_obj.create_at = '';
				}
				this.$u.api.$get('/crane/cycle', _obj, res => {
					if (res.code == 1) {
						let _data = res.data.list;
						if (_data.length < this.hoisting.size) {
							this.hoistNoMore = true;
							this.loadStatus.splice(1, 1, 'nomore');
						} else {
							this.loadStatus.splice(1, 1, 'loadmore');
						}
						this.hoistList = _data;
						this.hoisting.page = parseInt(res.data.page);
						let _height = this.APP.ratio > 1.1 ? 291 : 289;
						this.hoistHeight = parseInt(_height * this.hoistList.length * this.APP.ratio) + parseInt(
							60 * this.APP.ratio);
						this.hoistHeight = this.hoistHeight > windowHeight - 100 ? this.hoistHeight :
							windowHeight - 100;
						switch (parseInt(this.tabCurrent)) {
							case 0:
								this.height = this.totalHeight;
								break;
							case 1:
								this.height = this.historyHeight;
								break;
							case 2:
								this.height = this.hoistHeight;
								break;
							case 3:
								this.height = this.baseHeight;
								break;
							case 4:
								this.height = this.demarcateHeight;
								break;
							case 5:
								this.height = this.baseConfigHeight;
								break;
							default:
								break;
						}
					}
					this.isShowHoist = false;
				});
			},
			// 获取基本信息数据
			fnGetBaseInfo() {

				// 模拟数据，应后端获取
				let res =
					'{"id":1549,"project_id":11999,"number":"2000006607","record_number":"","install_location":"1","staff":"","extend":"{}","upload_status":null,"mfrs":"","status":1,"revise_at":"2024-07-03 15:48:51","create_at":"2024-07-03 12:54:56"}'
				let data = JSON.parse(res)


				let _data = data;
				this.baseInfo = _data;
				this.tower.install_location = _data.install_location;
				this.tower.record_number = _data.record_number;
				let _extend = JSON.parse(_data.extend);
				let _driverInfo = _extend.driverInfo ? _extend.driverInfo : {};
				let _eqptParameter = _extend.eqptParameter ? _extend.eqptParameter : {};
				let _protectionZone = _extend.protectionZone ? _extend.protectionZone : {};
				for (let i in _driverInfo) {
					this.driverInfo[i] = _driverInfo[i];
				}
				for (let j in _eqptParameter) {
					if (j == 'craneArmHeight' || j == 'craneArmLength' || j == 'towerHatHeight' || j ==
						'balanceArmLength') {
						this.eqptParameter[j] = _eqptParameter[j] / 10;
					} else {
						this.eqptParameter[j] = _eqptParameter[j];
					}
				}
				for (let k in _protectionZone) {
					if (k == 'type') {
						for (let m in this.protectionType) {
							if (_protectionZone[k] == this.protectionType[m].value) {
								this.selectProtectionType = this.protectionType[m].label;
							}
						}
					} else if (k == 'buildingType') {
						for (let m in this.facilitiesType) {
							if (_protectionZone[k] == this.facilitiesType[m].value) {
								this.selectFacilitiesType = this.facilitiesType[m].label;
							}
						}
					} else {
						this.protectionZone[k] = _protectionZone[k];
					}
				}

			},
			// 保存塔机基本字段
			fnSaveCraneBaseInfo() {
				if (this.eqptParameter.ropeRatio == '') {
					this.eqptParameter.ropeRatio = 2;
				}
				let _driverInfo = this.driverInfo;
				let _eqptParameter = this.eqptParameter;
				let _protectionZone = this.protectionZone;

				let _data = {
					id: this.baseInfo.id,
					project_id: this.baseInfo.project_id,
					number: this.baseInfo.number,
					record_number: this.tower.record_number,
					install_location: this.tower.install_location,
					staff: this.baseInfo.staff,
					extend: {
						driverInfo: _driverInfo,
						eqptParameter: _eqptParameter,
						protectionZone: _protectionZone
					}
				};
				_data.extend.eqptParameter.craneArmHeight *= 10;
				_data.extend.eqptParameter.craneArmLength *= 10;
				_data.extend.eqptParameter.towerHatHeight *= 10;
				_data.extend.eqptParameter.balanceArmLength *= 10;
				_data.extend = JSON.stringify(_data.extend);
				this.$u.api.$post('/crane/eqptInfo', _data, res => {
					if (res.code == 1) {
						this.$refs.uToast.show({
							title: res.data,
							type: 'success',
							position: 'top'
						});
					} else {
						this.$refs.uToast.show({
							title: res.data,
							type: 'error',
							position: 'top'
						});
					}
					let that = this;
					setTimeout(() => {
						that.fnInit(); // 刷新
					}, 1500);
				});
			},
			// 设备状态文字显示
			fnGetText(item) {
				if (!item) return '';
				let _text = this.APP.fnAccessStatusToText(item, 'crane').text;
				let _arr = _text.split(',');
				let _str = '';
				for (let i in _arr) {
					if (_arr[i].indexOf('正常') == -1) {
						_str += _arr[i];
					}
				}
				return _str;
			},
			// 切换swiper4 选项卡
			sectionChange(index) {
				this.curNow = index;
				// 根据选项卡 设置页面高度
				switch (parseInt(this.curNow)) {
					case 0:
						this.baseHeight = parseInt(700 * this.APP.ratio);
						this.height = this.baseHeight;
						break;
					case 1:
						this.baseHeight = parseInt(1320 * this.APP.ratio);
						this.height = this.baseHeight;
						break;
					case 2:
						this.baseHeight = parseInt(640 * this.APP.ratio);
						this.height = this.baseHeight;
						break;
					default:
						break;
				}
			},
			// 塔机保护区类型选择
			fnSelectProtectionType(val) {
				let _select = val;
				this.selectProtectionType = _select[0].label;
				this.protectionZone.type = _select[0].value;
			},
			// 塔机建筑设置类型选择
			fnSelectFacilitiesType(val) {
				let _select = val;
				this.selectFacilitiesType = _select[0].label;
				this.protectionZone.buildingType = _select[0].value;
			},
			// 选择图片
			fnChooseImage() {
				let that = this
				upload.fnUploadImg('crane', res => {
					if (res.code === 1) {
						that.driverInfo.photo = res.data
					} else {
						that.$refs.uToast.show({
							title: res.data,
							type: 'error',
							position: 'top '
						})
					}
				})
				// uni.chooseImage({
				//   count: 1,
				//   success: chooseImageRes => {
				//     const tempFilePaths = chooseImageRes.tempFilePaths;
				//     uni.uploadFile({
				//       url: this.APP.isTest ? this.APP.HOST.TEST.BASE_URL + '/file/uploadImg' : this.APP.HOST.OFFICIAL.BASE_URL + '/file/uploadImg',
				//       filePath: tempFilePaths[0],
				//       name: 'crane',
				//       formData: {
				//         type: 'crane'
				//       },
				//       header: {
				//         'X-Token': getUserToken()
				//       },
				//       success: uploadFileRes => {
				//         let _data = JSON.parse(uploadFileRes.data);
				//         this.driverInfo.photo = _data.data;
				//       }
				//     });
				//   }
				// });
			},
			// 选择创建时间
			fnChangeTime(e) {
				if (this.tabCurrent == 1) {
					// 搜索 历史记录 创建时间
					this.history.create_at = e.startDate + ',' + e.endDate;
				}
				if (this.tabCurrent == 2) {
					// 搜索 吊装记录 创建时间
					this.hoisting.create_at = e.startDate + ',' + e.endDate;
				}
			},
			// tab选项卡切换
			fnTabChange(index) {
				this.tabSwiper = index;
				if (index == 1) {
					this.history.is_alarm = '';
					this.historyNoMore = false;
					this.historyList = [];
					this.fnGetHistoryList();
				}
			},
			// 过渡 transition
			fnTabTransition({
				detail: {
					dx
				}
			}) {
				this.$refs.tabs.setDx(dx);
			},
			// 动画 animationfinish
			fnTabAnimationFinish({
				detail: {
					current
				}
			}) {
				this.$refs.tabs.setFinishCurrent(current);
				this.tabSwiper = current;
				this.tabCurrent = current;
				// 根据选项卡 设置页面高度
				switch (parseInt(this.tabCurrent)) {
					case 0:
						this.height = this.totalHeight;
						break;
					case 1:
						this.height = this.historyHeight;
						break;
					case 2:
						this.height = this.hoistHeight;
						break;
					case 3:
						this.height = this.baseHeight;
						break;
					case 4:
						this.height = this.demarcateHeight;
						break;
					case 5:
						this.height = this.baseConfigHeight;
						break;
					default:
						break;
				}
			},
			// 统计折线图
			fnShowTabLine(canvasId, chartData) {
				canvasObj[canvasId] = new uCharts({
					$this: _self,
					canvasId: canvasId,
					type: 'area',
					fontSize: 11,
					padding: [15, 15, 0, 15],
					legend: {
						show: true,
						padding: 5,
						lineHeight: 11,
						margin: 5
					},
					background: '#FFFFFF',
					pixelRatio: _self.pixelRatio,
					rotate: true, //开启图表横屏
					// #ifdef MP-ALIPAY
					rotateLock: true, //百度及支付宝需要锁定旋转
					// #endif
					categories: chartData.categories,
					animation: false,
					series: chartData.series,
					xAxis: {
						type: 'grid',
						gridColor: '#CCCCCC',
						gridType: 'dash',
						dashLength: 8,
						boundaryGap: 'justify' //两端不留白配置
					},
					yAxis: {
						// format:(val)=>{return val.toFixed(0)+'%'},
						gridType: 'dash',
						gridColor: '#CCCCCC',
						dashLength: 8,
						splitNumber: 5
					},
					width: _self.cWidth * _self.pixelRatio,
					height: _self.cHeight * _self.pixelRatio,
					dataLabel: true,
					dataPointShape: true,
					extra: {
						area: {
							type: 'curve',
							opacity: 0.2,
							addLine: true,
							width: 2
						}
					}
				});
			},
			// 点击折线图内容显示
			touchIt(e, id) {
				canvasObj[id].touchLegend(e, {
					animation: false
				});
				canvasObj[id].showToolTip(e, {
					format: function(item, category) {
						if (typeof item.data === 'object') {
							return category + ' ' + item.name + ':' + item.data.value;
						} else {
							return category + ' ' + item.name + ':' + item.data;
						}
					}
				});
			},
			//切换swiper5 选项卡
			demarcateChange(index) {
				this.curDemarcate = index;
			},

			// 获取标定
			fnGetCalibrationParam(type, index) {
				if (this.APP.fnOnlineStatusText(this.eqptInfo.heartbeatTime).status == 0) {
					this.$refs.uToast.show({
						title: '该设备不在线，无法获取！',
						type: 'warning',
						position: 'top'
					});
					return
				}
				let _obj = {
					number: this.eqptInfo.number,
					type: type
				};
				this.isLoading = true
				// 默认url - 灿远
				let _url = this.APP.isTest ? this.APP.HOST.TEST.EQPT_URL + '/getCalibrationParam' : this.APP.HOST.OFFICIAL
					.EQPT_URL + '/getCalibrationParam'
				// 如果 设备号 以 2 开头 换 域名
				if (this.eqptInfo.number.slice(0, 1) == 2) {
					_url = this.APP.isTest ? this.APP.HOST.TEST.EQPT_JZ_URL + '/getCalibrationParam' : this.APP.HOST
						.OFFICIAL.EQPT_JZ_URL + '/getCalibrationParam'
				}
				uni.request({
					url: _url,
					method: 'GET',
					data: _obj,
					header: {
						'X-Token': getProjectToken() //自定义请求头信息
					},
					success: res => {
						if (res.data.code == 1) {
							this.fnSetInfo(this.eqptInfo.number, type, index, res.data);
						} else {
							this.$refs.uToast.show({
								title: res.data.data,
								type: 'error',
								position: 'top'
							});
						}
						this.isLoading = false
					}
				});
			},
			// 获取完标定以后设置到页面
			fnSetInfo(number, type, index, res) {
				let _jz = number.slice(0, 1) == 2
				switch (type) {
					case 1:
						index == 1 ? (this.weightInfo.calibration1 = _jz ? res.data : (res.data / 1000000)) : (this
							.weightInfo.calibration2 = _jz ? res.data : (res.data / 1000000));
						break;
					case 2:
						index == 1 ? (this.heightInfo.calibration1 = _jz ? res.data : (res.data / 1000000)) : (this
							.heightInfo.calibration2 = _jz ? res.data : (res.data / 1000000));
						break;
					case 3:
						index == 1 ? (this.rangeInfo.calibration1 = _jz ? res.data : (res.data / 1000000)) : (this
							.rangeInfo.calibration2 = _jz ? res.data : (res.data / 1000000));
						break;
					case 4:
						index == 1 ? (this.rotationInfo.calibration1 = _jz ? res.data : (res.data / 1000000)) : (this
							.rotationInfo.calibration2 = _jz ? res.data : (res.data / 1000000));
						break;
					case 5:
						if (index == 1) {
							this.dipInfo.actual1 = _jz ? res.data.x : (res.data.x / 1000000);
							this.dipInfo.calibration1 = _jz ? res.data.y : (res.data.y / 1000000);
						} else {
							this.dipInfo.actual2 = _jz ? res.data.x : (res.data.x / 1000000);
							this.dipInfo.calibration2 = _jz ? res.data.y : (res.data.y / 1000000);
						}
						break;
					default:
						break;
				}
			},
			// 保存 标定
			fnSendCalibrationParam(type) {
				let _obj = {};
				switch (type) {
					case 1: // 重量
						let num1 = 0;
						for (let i in this.weightInfo) {
							num1 += 1;
							if (this.weightInfo[i] === '') {
								let _index = num1 == 1 ? 1 : num1 == 2 ? 1 : num1 == 3 ? 2 : 2;
								let _s = num1 % 2 != 0 ? '重量' + _index : '值' + _index;
								let _str = '实际' + _s + '不能为空';
								this.$refs.uToast.show({
									title: _str,
									type: 'warning',
									position: 'top'
								});
								return;
							}
						}
						_obj = JSON.parse(JSON.stringify(this.weightInfo));
						break;
					case 2: // 高度
						let num2 = 0;
						for (let i in this.heightInfo) {
							num2 += 1;
							if (this.heightInfo[i] === '') {
								let _index = num2 == 1 ? 1 : num2 == 2 ? 1 : num2 == 3 ? 2 : 2;
								let _s = num2 % 2 != 0 ? '高度' + _index : '值' + _index;
								let _str = '实际' + _s + '不能为空';
								this.$refs.uToast.show({
									title: _str,
									type: 'warning',
									position: 'top'
								});
								return;
							}
						}
						_obj = JSON.parse(JSON.stringify(this.heightInfo));
						break;
					case 3: // 幅度
						let num3 = 0;
						for (let i in this.rangeInfo) {
							num3 += 1;
							if (this.rangeInfo[i] === '') {
								let _index = num3 == 1 ? 1 : num3 == 2 ? 1 : num3 == 3 ? 2 : 2;
								let _s = num3 % 2 != 0 ? '位置' + _index : '值' + _index;
								let _str = '实际' + _s + '不能为空';
								this.$refs.uToast.show({
									title: _str,
									type: 'warning',
									position: 'top'
								});
								return;
							}
						}
						_obj = JSON.parse(JSON.stringify(this.rangeInfo));
						break;
					case 4: // 回转
						let num4 = 0;
						for (let i in this.rotationInfo) {
							num4 += 1;
							if (this.rotationInfo[i] === '') {
								let _index = num4 == 1 ? 1 : num4 == 2 ? 1 : num4 == 3 ? 2 : 2;
								let _s = num4 % 2 != 0 ? '转角' + _index : '值' + _index;
								let _str = '实际' + _s + '不能为空';
								this.$refs.uToast.show({
									title: _str,
									type: 'warning',
									position: 'top'
								});
								return;
							}
						}
						_obj = JSON.parse(JSON.stringify(this.rotationInfo));
						break;
					case 5: // 倾角
						let num5 = 0;
						for (let i in this.dipInfo) {
							num5 += 1;
							if (this.dipInfo[i] === '') {
								let _index = num5 == 1 ? 1 : num5 == 2 ? 1 : num5 == 3 ? 2 : 2;
								let _s = num5 % 2 != 0 ? 'X轴实际角度' + _index : 'Y轴实际角度' + _index;
								let _str = _s + '不能为空';
								this.$refs.uToast.show({
									title: _str,
									type: 'warning',
									position: 'top'
								});
								return;
							}
						}
						_obj = JSON.parse(JSON.stringify(this.dipInfo));
						break;
					default:
						break;
				}
				let _jz = this.eqptInfo.number.slice(0, 1) == 2
				if (!_jz) {
					for (let i in _obj) {
						_obj[i] = '' + _obj[i] * 1000000;
					}
				}
				_obj.type = type;
				_obj.number = this.eqptInfo.number;
				if (type != 5) {
					let _str = type == 1 ? '重量' : type == 2 ? '高度' : type == 3 ? '幅度' : type == 4 ? '回转' : '倾角';
					if (_obj.actual1 == _obj.actual2) {
						this.$refs.uToast.show({
							title: '两个实际' + _str + '值不能相同!',
							type: 'warning',
							position: 'top'
						});
						return;
					}
					if (_obj.calibration1 == _obj.calibration2) {
						this.$refs.uToast.show({
							title: '两个实际值不能相同！',
							type: 'warning',
							position: 'top'
						});
						return;
					}
				}
				this.isLoading = true
				// 默认url - 灿远
				let _url = this.APP.isTest ? this.APP.HOST.TEST.EQPT_URL + '/sendCalibrationParam' : this.APP.HOST.OFFICIAL
					.EQPT_URL + '/sendCalibrationParam'
				// 如果 设备号 以 2 开头 换 域名
				if (this.eqptInfo.number.slice(0, 1) == 2) {
					_url = this.APP.isTest ? this.APP.HOST.TEST.EQPT_JZ_URL + '/sendCalibrationParam' : this.APP.HOST
						.OFFICIAL.EQPT_JZ_URL + '/sendCalibrationParam'
				}
				uni.request({
					url: _url,
					method: 'POST',
					data: _obj,
					header: {
						'X-Token': getProjectToken(), //自定义请求头信息
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					success: res => {
						let _str = type == 1 ? '重量' : type == 2 ? '高度' : type == 3 ? '幅度' : type == 4 ? '回转' :
							'倾角';
						this.$refs.uToast.show({
							title: _str + res.data.data,
							type: 'success',
							position: 'top'
						});
						this.isLoading = false
					}
				});
			},
			// 获取基本配置
			fnGetBasicParamConfig() {
				if (this.APP.fnOnlineStatusText(this.eqptInfo.heartbeatTime).status == 0) return
				this.isLoading = true
				// 默认url - 灿远
				let _url = this.APP.isTest ? this.APP.HOST.TEST.EQPT_URL + '/getBasicParamConfig' : this.APP.HOST.OFFICIAL
					.EQPT_URL + '/getBasicParamConfig'
				// 如果 设备号 以 2 开头 换 域名
				if (this.eqptInfo.number.slice(0, 1) == 2) {
					_url = this.APP.isTest ? this.APP.HOST.TEST.EQPT_JZ_URL + '/getBasicParamConfig' : this.APP.HOST
						.OFFICIAL.EQPT_JZ_URL + '/getBasicParamConfig'
				}
				uni.request({
					url: _url,
					method: 'GET',
					data: {
						number: this.eqptInfo.number
					},
					header: {
						'X-Token': getProjectToken() //自定义请求头信息
					},
					success: res => {
						if (res.data.code == 1) {
							let _data = res.data.data;
							this.setInfo.time = _data.time ? this.APP.fnGetFullDateFormat(_data.time * 1000) :
								''; //系统时间戳
							this.setInfo.type = _data.type == 0 ? '0' : '1'; // 塔机类型 0尖塔1平塔
							this.setInfo.craneArmLength = _data.craneArmLength ? _data.craneArmLength / 100 :
								''; // 大臂长度 2位小数
							this.setInfo.balanceArmLength = _data.balanceArmLength ? _data.balanceArmLength /
								100 : ''; // 平衡长度 2位小数
							this.setInfo.towerHatHeight = _data.towerHatHeight ? _data.towerHatHeight / 100 :
								''; // 塔帽高度 2位小数
							this.setInfo.craneArmHeight = _data.craneArmHeight ? _data.craneArmHeight / 100 :
								''; // 塔身高度 2位小数
							this.setInfo.model = _data.model ? _data.model : ''; // 塔机型号
							this.setInfo.slingRatio = _data.slingRatio ? _data.slingRatio : ''; // 吊绳倍率 2/4/6/8
							this.setInfo.maxLiftingWeight = _data.maxLiftingWeight ? _data.maxLiftingWeight /
								100 : ''; // 最大载重 2位小数
							this.setInfo.maxTorque = _data.maxTorque ? _data.maxTorque / 100 : ''; // 最大力矩 2位小数
							this.setInfo.maxwindSpeed = _data.maxwindSpeed ? _data.maxwindSpeed / 100 :
								''; // 最大风速 2位小数
							this.setInfo.installationLongitude = _data.installationLongitude ? _data
								.installationLongitude / 1000000 : ''; // 经度 6位小数
							this.setInfo.installationLatitude = _data.installationLatitude ? _data
								.installationLatitude / 1000000 : ''; // 纬度 6位小数
							this.setInfo.dueNorthDeflection = _data.dueNorthDeflection !== '' ? _data
								.dueNorthDeflection / 100 : ''; // 正北偏转 2位小数
							this.setInfo.SIM = _data.SIM ? _data.SIM : '';
						} else {
							this.$refs.uToast.show({
								title: res.data.data,
								type: 'error',
								position: 'top'
							});
						}
						this.isLoading = false
					}
				});
			},
			// 保存基本配置
			fnSendBasicParamConfig() {
				let _needField = {
					type: '塔机类型',
					craneArmLength: '大臂长度', // 2位小数
					balanceArmLength: '平衡长度', // 2位小数
					towerHatHeight: '塔帽高度', // 2位小数
					craneArmHeight: '塔身高度', // 2位小数
					model: '塔机型号',
					slingRatio: '吊绳倍率', // 2/4/6/8
					maxLiftingWeight: '最大载重', // 2位小数
					maxTorque: '最大力矩', // 2位小数
					maxwindSpeed: '最大风速', // 2位小数
					installationLongitude: '经度', // 6位小数
					installationLatitude: '纬度', // 6位小数
					dueNorthDeflection: '正北偏转' // 2位小数
				};
				for (let _key in _needField) {
					if (this.setInfo[_key] === null || this.setInfo[_key] === '' || this.setInfo[_key] === undefined) {
						this.$refs.uToast.show({
							title: _needField[_key] + '不能为空!',
							type: 'warning',
							position: 'top'
						});
						return;
					}
				}
				let _obj = JSON.parse(JSON.stringify(this.setInfo));
				let _jz = this.eqptInfo.number.slice(0, 1) == 2 // 如果是巨正 保存时（大臂长度，平衡臂长，塔帽高度，塔身高度，吊绳倍率，最大载重，最大风速）乘10 否则乘100
				delete _obj.SIM
				delete _obj.time
				_obj.number = this.eqptInfo.number
				_obj.craneArmLength = _obj.craneArmLength * (_jz ? 10 : 100) // 大臂长度
				_obj.balanceArmLength = _obj.balanceArmLength * (_jz ? 10 : 100) // 平衡长度
				_obj.towerHatHeight = _obj.towerHatHeight * (_jz ? 10 : 100) // 塔帽高度
				_obj.craneArmHeight = _obj.craneArmHeight * (_jz ? 10 : 100) // 塔身高度
				_obj.maxLiftingWeight = _obj.maxLiftingWeight * (_jz ? 10 : 100) // 最大载重
				_obj.maxTorque = _obj.maxTorque * 100 // 最大力矩
				_obj.maxwindSpeed = _obj.maxwindSpeed * (_jz ? 10 : 100) // 最大风速
				_obj.installationLongitude = _obj.installationLongitude * 1000000 // 经度
				_obj.installationLatitude = _obj.installationLatitude * 1000000 // 纬度
				_obj.dueNorthDeflection = _obj.dueNorthDeflection * 100 // 正北偏转
				_obj.slingRatio = _obj.slingRatio * (_jz ? 0.1 : 1) // 吊绳倍率
				this.isLoading = true
				// 默认url - 灿远
				let _url = this.APP.isTest ? this.APP.HOST.TEST.EQPT_URL + '/sendBasicParamConfig' : this.APP.HOST.OFFICIAL
					.EQPT_URL + '/sendBasicParamConfig'
				// 如果 设备号 以 2 开头 换 域名
				if (this.eqptInfo.number.slice(0, 1) == 2) {
					_url = this.APP.isTest ? this.APP.HOST.TEST.EQPT_JZ_URL + '/sendBasicParamConfig' : this.APP.HOST
						.OFFICIAL.EQPT_JZ_URL + '/sendBasicParamConfig'
				}
				uni.request({
					url: _url,
					method: 'POST',
					data: _obj,
					header: {
						'X-Token': getProjectToken(), //自定义请求头信息
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					success: res => {
						this.$refs.uToast.show({
							title: res.data.data,
							type: 'sucess',
							position: 'top'
						});
						this.isLoading = false
					}
				});
			},
			// 获取经纬度
			fnGetLocation() {
				uni.chooseLocation({
					success: (res) => {
						this.setInfo.installationLongitude = parseFloat(res.longitude).toFixed(6)
						this.setInfo.installationLatitude = parseFloat(res.latitude).toFixed(6)
					}
				})
			}
		}
	};
</script>

<style scoped lang="scss">
	@import '@/common/css/base.scss';

	.tab_one_top {
		width: 688rpx;
		height: 248rpx;
		border-radius: 24rpx;
		margin: 40rpx auto 0;
		box-shadow: 0 0 24rpx rgba(0, 0, 0, 0.16);
		@include prefixCss3(background, linear-gradient(to bottom, #569dfa 0%, #3776f6 100%));

		.top_cont {
			width: 645rpx;
			height: 160rpx;

			.cont_item {
				width: 215rpx;
				height: 160rpx;

				.item_num {
					width: 215rpx;
					height: 100rpx;
					line-height: 100rpx;
					text-align: center;
					font-size: 56rpx;
					color: #ffffff;

					&.red {
						color: #fa3534;
					}

					&.green {
						color: #14d2b8;
					}
				}

				.item_text {
					width: 215rpx;
					height: 60rpx;
					line-height: 60rpx;
					text-align: center;
					color: #ffffff;
					font-size: 24rpx;
				}
			}
		}
	}

	.tab_list {
		width: 688rpx;
		height: 554rpx;
		margin: 64rpx auto 0;
		border-radius: 24rpx;
		box-shadow: 0 0 24rpx rgba(0, 0, 0, 0.16);

		.list_cont {
			width: 620rpx;
			height: 510rpx;

			.cont_title {
				width: 620rpx;
				height: 60rpx;
				font-size: 24rpx;
				color: #6e6e6e;

				.orange {
					color: #ff9900;
				}

				.red {
					color: #fa3534;
				}

				.title_left {
					width: 370rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}

				.title_right {
					width: 250rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}
			}

			.cont_item {
				width: 620rpx;
				height: 150rpx;

				.item_one {
					width: 155rpx;
					height: 150rpx;

					.item_num {
						width: 155rpx;
						height: 100rpx;
						line-height: 100rpx;
						font-size: 44rpx;
						color: #373737;
						text-align: center;

						&.orange {
							color: #ff9900;
						}

						&.red {
							color: #fa3534;
						}
					}

					.item_text {
						width: 155rpx;
						height: 50rpx;
						line-height: 50rpx;
						text-align: center;
						color: #9f9f9f;
						font-size: 24rpx;
					}
				}
			}
		}
	}

	.chart_box {
		width: 700rpx;
		height: 1600rpx;
		margin: 72rpx auto 0;
		position: relative;

		.charts {
			position: absolute;
			width: 700rpx;
			height: 1600rpx;
		}
	}

	.record_box {
		width: 688rpx;
		height: 528rpx;
		border-radius: 24rpx;
		margin: 50rpx auto 0;
		box-shadow: 0 0 24rpx rgba(0, 0, 0, 0.16);

		.record_cont {
			width: 620rpx;
			height: 480rpx;

			.cont_time {
				width: 620rpx;
				height: 50rpx;
				line-height: 50rpx;
				text-align: right;
				color: #6e6e6e;
				font-size: 24rpx;
			}

			.cont_item {
				width: 620rpx;
				height: 140rpx;

				.item_one {
					width: 155rpx;
					height: 140rpx;

					.item_num {
						width: 155rpx;
						height: 90rpx;
						line-height: 90rpx;
						text-align: center;
						font-size: 44rpx;
						color: #373737;
					}

					.item_text {
						width: 155rpx;
						height: 50rpx;
						line-height: 50rpx;
						text-align: center;
						font-size: 24rpx;
						color: #9f9f9f;
					}
				}
			}

			.cont_times {
				width: 620rpx;
				height: 120rpx;
				margin-top: 30rpx;

				.time_box {
					width: 309rpx;
					height: 120rpx;

					.title {
						width: 309rpx;
						height: 60rpx;
						line-height: 60rpx;
						text-align: center;
						font-size: 24rpx;
						color: #9f9f9f;

						image {
							width: 28rpx;
							height: 28rpx;
							margin-right: 10rpx;
						}
					}

					.time {
						width: 309rpx;
						height: 60rpx;
						line-height: 60rpx;
						text-align: center;
						font-size: 28rpx;
						color: #9f9f9f;
					}
				}

				.time_line {
					width: 1rpx;
					height: 60rpx;
					background-color: rgba(112, 112, 112, 0.5);
				}
			}
		}
	}

	.select_item {
		width: 100%;
		height: 76rpx;
		margin-top: 20rpx;
	}

	.field_item {
		width: 668rpx;
		height: 116rpx;
		margin: 0 auto;
		border-bottom: 1rpx solid #cecece;
		font-size: 24rpx;

		.item_left {
			width: 220rpx;
			height: 60rpx;
			line-height: 60rpx;
			color: #707070;
		}

		.item_right {
			width: 448rpx;
			height: 60rpx;
			line-height: 60rpx;
			text-align: right;
			color: #373737;
		}

		&.pic {
			height: 260rpx;
			border: none;
			padding-top: 40rpx;

			.item_left {
				width: 220rpx;
				height: 220rpx;
			}

			.item_right {
				width: 448rpx;
				height: 220rpx;

				.add_pic {
					width: 200rpx;
					height: 200rpx;
					border-radius: 10rpx;
					border: 1rpx dashed #c8c8c8;

					image {
						width: 72rpx;
						height: 72rpx;
					}

					.photo {
						width: 200rpx;
						height: 200rpx;
						border-radius: 10rpx;
					}
				}
			}
		}

		&:last-child {
			margin-bottom: 40rpx;
		}
	}

	.popup_title {
		width: 100%;
		height: 90rpx;
		line-height: 90rpx;
		font-size: 36rpx;
		text-align: center;
		padding: 0 20rpx;

		.close {
			width: 60rpx;
			height: 60rpx;

			image {
				width: 48rpx;
				height: 48rpx;
			}
		}
	}

	.popup_field {
		width: 100%;
		height: 120rpx;
		padding: 0 20rpx;
		margin-top: 10rpx;
		border-bottom: 1rpx solid #bbbbbb;

		.item {
			height: 120rpx;
			font-size: 26rpx;

			&:first-child {
				width: 120rpx;
			}

			&:last-child {
				width: 410rpx;
				margin-left: 20rpx;
			}
		}
	}

	.return_right {
		width: 60rpx;
		overflow: hidden;
		transition: height 0.5s;

		&.hide {
			width: 0;
		}
	}

	.loading {
		width: 80rpx;
		height: 80rpx;
		position: fixed;
		top: 50%;
		left: 50%;
		margin-top: -40rpx;
		margin-left: -40rpx;
	}
</style>